package com.huawei.appmarket.service.settings.activity;

import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.os.Bundle;
import com.huawei.appgallery.foundation.ui.framework.activity.BaseActivity;
import com.huawei.appmarket.service.settings.view.GotoHealthDialogActivityProtocol;
import o.ayw;
import o.ayy;
import o.cks;
import o.cku;
import o.der.f;
import o.Logger;
import o.efz;
import o.egv;

public class GotoHealthDialogActivity extends BaseActivity<GotoHealthDialogActivityProtocol> {
    private cku ˊॱ;
    private boolean ˋॱ;

    public void onCreate(Bundle bundle) {
        ayy.ˋ().ˎ(getWindow());
        requestWindowFeature(1);
        ayw.ॱ(this);
        super.onCreate(bundle);
        if (!(ʾ() == null || ((GotoHealthDialogActivityProtocol) ʾ()).ˏ() == null)) {
            this.ˋॱ = ((GotoHealthDialogActivityProtocol) ʾ()).ˏ().ˊ();
        }
        egv ॱᐝ = egv.ॱᐝ();
        if (ॱᐝ instanceof efz) {
            ((efz) ॱᐝ).ॱ();
        }
        ᐝ();
    }

    private void ᐝ() {
        this.ˊॱ = cku.ˋ(null, getString(f.ˊˊ));
        this.ˊॱ.ॱ(new cks(this) {
            final /* synthetic */ GotoHealthDialogActivity ˎ;

            {
                this.ˎ = r1;
            }

            public void enableNetworking() {
                this.ˎ.ͺ();
            }

            public void upgrade() {
            }

            public void ˋ() {
            }
        });
        this.ˊॱ.ॱ(this, getClass().getSimpleName());
        this.ˊॱ.ॱ(-1, getString(f.ˋᐝ));
        this.ˊॱ.ॱ(-2, getString(f.ॱʾ));
        this.ˊॱ.ˎ(new OnDismissListener(this) {
            final /* synthetic */ GotoHealthDialogActivity ˎ;

            {
                this.ˎ = r1;
            }

            public void onDismiss(DialogInterface dialogInterface) {
                if (!this.ˎ.isFinishing()) {
                    this.ˎ.finish();
                }
                if (this.ˎ.ˋॱ) {
                    egv.ॱᐝ().ˋˊ();
                }
            }
        });
    }

    public void onStop() {
        super.onStop();
        if (this.ˊॱ != null && this.ˊॱ.isAdded()) {
            this.ˊॱ.dismissAllowingStateLoss();
        }
    }

    private void ͺ() {
        Logger.ˎ("GotoHealthDialogActivity", "startSystemHealthyUsePhoneActivity:");
        Intent intent = new Intent();
        intent.setFlags(268435456);
        intent.setClassName("com.huawei.parentcontrol", "com.huawei.parentcontrol.ui.activity.HomeActivity");
        try {
            startActivityForResult(intent, 1001);
        } catch (ActivityNotFoundException e) {
            Logger.ˋ("GotoHealthDialogActivity", e.getMessage());
        }
    }
}
